package rt.crashmere.server.service;

import com.baomidou.mybatisplus.extension.service.IService;
import rt.crashmere.rpc.provider.UserProvider;
import rt.crashmere.server.model.domain.User;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Lwh
 * @description 针对表【user(用户)】的数据库操作Service
 * @createDate 2023-01-24 15:53:24
 */
public interface UserService extends IService<User>, UserProvider {

    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    int userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @return 脱敏后的用户信息
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 获取当前登录用户
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 是否为管理员
     */
    boolean isNotAdmin(HttpServletRequest request);

    /**
     * 用户注销
     */
    boolean userLogout(HttpServletRequest request);

}
